package com.Txunda.fxw.tipstoast;


import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.Txunda.fxw.R;

public class Mydialog extends Dialog
		 {

	private Context context;
	private LeftListener listener;
	private Button btn_ok;
	private Button btn_quxiao;
	private LinearLayout dialog_lay;
	private RightListener listener2;
	private String leftcontent;
	private String rightcontent;
	private TextView tv_title;
	private String title;
	private TextView tv_content;
	private String content;

	/** 定义dialog点击事件接口 */
	public interface LeftListener {
		public void onClick1(View view);
	}

	public interface RightListener {
		public void onClick2(View view);
	}

	// public Mydialog(Context context, int theme,
	// LeaveMyDialogListener leaveMyDialogListener) {
	// super(context, theme);
	// // TODO Auto-generated constructor stub
	// this.context = context;
	// this.listener = leaveMyDialogListener;
	// }

	public Mydialog(Context context, String title,String content,String leftcontent,
			String rightcontent, LeftListener listener, RightListener listener2) {
		super(context, R.style.mydialog11);
		 this.context = context;
		 this.leftcontent = leftcontent;
		 this.content = content;
		 this.title = title;
		 this.rightcontent = rightcontent;
		 this.listener = listener;
		 this.listener2 = listener2;
	}

	public Mydialog(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
		this.context = context;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.mydialog);
		btn_ok = findViewById(R.id.btn_ok);
		tv_title = findViewById(R.id.tv_title);
		tv_content = findViewById(R.id.tv_content);
		tv_content.setText(content);
		tv_title.setText(title);
		btn_ok.setText(rightcontent);
		btn_quxiao = findViewById(R.id.btn_quxiao);
		btn_quxiao.setText(leftcontent);
		dialog_lay = findViewById(R.id.dialog_lay);
		btn_ok.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				if (listener2!=null) {
					listener2.onClick2(arg0);
				}
				
				dismiss();
			}
		});
		btn_quxiao.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				if (listener!=null) {
					listener.onClick1(arg0);
				}
				dismiss();
			}
		});

	}


}
